<template>
	<view class="page">
		<z-paging ref="paging" v-model="dataList" @query="queryList">
			<view slot="top">
				<u-navbar :isBack="true" title="我的团队" title-color="#101010" 
				:background="{background: 'none'}" :borderBottom="false"></u-navbar>
				<!-- <view class="head">
					<view class="" style="align-items: center;width: 100%;">
						<u-search placeholder="请输入关键词" v-model="keyword" :show-action="false" @search="onSearch" 
						bg-color="#fbfbfb"></u-search>
					</view>
				</view> -->
				<view style="padding: 32rpx;">
					<view style="padding: 20rpx 24rpx;background: #fff;border-radius: 24rpx;">
						<view style="display: flex;align-items: center;">
							<image src="@/static/my/ss.png" mode="widthFix" style="width: 40rpx;"></image>
							<view style="margin-left: 8rpx;">
								<input type="text" placeholder="请搜索" v-model="keyword" @confirm="onSearch" />
							</view>
						</view>
					</view>
				</view>
			</view>
			
			<view style="padding: 0rpx 32rpx 0 32rpx;">
				<view style="padding: 0rpx 24rpx;background: #fff;border-radius: 24rpx;">
					
					<view style="padding: 32rpx 0;display: flex;align-items: center;border-bottom: 2rpx #F5F5F5 solid;"
						@click="jumpTo('/pages/news/im/private')" v-for="(item, index) in dataList" :key="index">
						<view style="flex: 1;font-size: 28rpx;">
							<view style="display: flex;justify-content: space-between;">
								<view style="color: #111111;font-weight: bold;">{{item.name}}</view>
								<view style="font-size: 24rpx;color: #CCCED1;" v-if="item.is_voucher == 1">
									<text style="font-size: 20rpx;color: #19be6b;background: #dbf1e1;
									padding: 4rpx 12rpx;border-radius: 8rpx;">已完成</text>
								</view>
								<view style="font-size: 24rpx;color: #CCCED1;" v-else>
									<text style="font-size: 20rpx;color: #fa3534;background: #fef0f0;
									padding: 4rpx 12rpx;border-radius: 8rpx;">未完成</text>
								</view>
							</view>
							<view style="display: flex;justify-content: space-between;margin-top: 16rpx;">
								<view style="color: #999CA3;">{{item.shipinhao}}</view>
							</view>
						</view>
					</view>
					
				</view>
			</view>
		
			<view style="height: 60rpx;"></view>
		
		</z-paging>
		
	
		<u-toast ref="uToast" />
		
	</view>
</template>

<script>
	import appurl_config from 'utils/config.js'
	import {request} from 'utils/request.js'
	import Vue from 'vue'
	var moment = require('moment');
	export default {
		data() {
			return {
				
				dataList: [],
				keyword: ''
				
			}
		},
		onLoad() {
			// 告诉页面需要刷新
			uni.$on('refreshHtml', (e) => {
				this.$refs.paging.reload();
				console.log('子页面---->>>>>>', e);
			})
			
			uni.hideShareMenu();
		},
		methods: {
			// 获取商品列表
			queryList(pageNo, pageSize) {
				let params = {};
				params.page = pageNo;
				params.keyword = this.keyword;
				request.postWithToken({
					url: '/user/myPromotion',
					data: params
				}).then(res=>{
					// console.log(res)
					this.$refs.paging.complete(res.data.ancestorsData);
				})
			},
			// 搜索
			onSearch(){
				this.$refs.paging.reload();
			},
			jumpTo(path){
				uni.navigateTo({
					url:path
				})
			},
			toDetail(item){
				Vue.prototype.MeetInfo = item
				uni.navigateTo({
					url:'detail'
				})
			},
		}
	}
</script>

<style>
	page{
		background-color: #F5F8FF !important;
	}
</style>
<style lang="scss" scoped>
	
</style>
